//
//  ViewController.m
//  HelloWorld
//
//  Created by Leone Keijzer on 07/09/2011.
//  Copyright (c) 2011 Cameraland. All rights reserved.
//

#import "ViewController.h"

@implementation ViewController



#pragma mark - View lifecycle

- (void)viewDidLoad {
    [super viewDidLoad];
	[NSTimer scheduledTimerWithTimeInterval:0.01 
                                     target:self 
                                   selector:@selector(gameUpdate:) 
                                   userInfo:nil repeats:YES];
}

- (void)viewDidUnload {
    [super viewDidUnload];
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
}

- (void)viewWillDisappear:(BOOL)animated
{
	[super viewWillDisappear:animated];
}

- (void)viewDidDisappear:(BOOL)animated
{
	[super viewDidDisappear:animated];
}

#pragma mark - Accessors

- (void)gameUpdate:(NSTimer*)theTimer {
    if([motionControl getDistance] > 0){
        [gameSurface moveShip:[motionControl getDistance] angle:[motionControl getAngle]];
    }
}

#pragma mark - Orientation

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown || interfaceOrientation != UIInterfaceOrientationPortrait);
}

#pragma mark - Memory management

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end
